#ifndef _WDS_BULLET_H_
#define _WDS_BULLET_H_

#include "ui/ui_manager.h"
#include "math/movement.h"
#include "math/facing.h"

class WDSLifeObject;

class WDSBullet
{
public:

	enum BULLET_TYPES
	{
		BULLET_TYPE_NORMAL,
		BULLET_TYPE_FIRE,
		BULLET_TYPE_GAUSS,
		BULLET_TYPE_ION,
		BULLET_TYPE_ROCKET,
		BULLET_TYPE_HOMINGROCKET,
		BULLET_TYPE_FLAME,
		BULLET_TYPE_PLASMA,
		BULLET_TYPE_PLASMACANNON,
		BULLET_TYPE_PULSE,

		BULLET_TYPE_C,

	};

	enum STARTPOS
	{
		STARTPOS_LEFT,
		STARTPOS_RIGHT,
		STARTPOS_MIDDLE
	};

	

	WDSBullet(	float Speed, 
				bool Rotate,
				float DamagePower,
				BULLET_TYPES Type
				);
	

	virtual void					Render(const math::Vec2& Offset,float Scale);
	virtual void					RenderDebug(const math::Vec2& Offset,float Scale);
	virtual void					Tick(float dt, float SkillBulletSpeed, const math::Vec2& Offset);
	virtual void					ReSpawn(const math::Vec2& Pos,
											WDSBullet::STARTPOS StartDir,
											float Degree
											);


	virtual void					Clear();
	virtual	void					Kill();	
	virtual void					OnHit(WDSLifeObject* pObj){};
	virtual bool					IsCanRespawn() const;
	virtual float					GetRadius() const { return m_Radius; };	

	static std::string				GetSpriteNameByType(WDSBullet::BULLET_TYPES Type);
	void							Load(const std::string& Name);

	bool							IsAlive()const { return m_IsAlive; };
	
	const math::Vec2&				GetPos() const { return m_Movement.GetPos(); };
	const math::Vec2&				GetPreviousPos() const  { return m_Movement.GetPreviousPos(); };
	float							GetHowlong() const  { return m_Howlong; };	

	
	ui::UISprite*					GetSprite()  { return &m_Sprite; };
	void							SetDelay(float Delay) { m_Delay = Delay; };
	float							GetDamagePower() const;	
	BULLET_TYPES					GetType() const { return m_Type; };
	
	void							SetVariation(const math::Vec2& V) { m_Variation = V; };
	void							SetSpeedVariationScale(float Scale);	
	bool							GetIsTypeGauss() const { return m_IsTypeGauss;	};
	void							SetIsTypeGauss(bool b) { m_IsTypeGauss = b;	};
	void							SetIgnoreObj(WDSLifeObject* pObject) { m_pIgnoreObj = pObject; };
	WDSLifeObject*					GetIgnoreObj() const { return m_pIgnoreObj;	};
	void							SetLeaveAlphaTrial(bool b) { m_bLeaveAlphaTrail = b; };
	void							SetMoveBonus( float BonusScale);	
	void							SetDamagePercentage(float PerC) { m_DamagePercentage = PerC; };

protected:

	
	float							GetDamagePercentage() const { return m_DamagePercentage; };

	float							m_Speed;	
	float							m_Howlong;

	ui::UISprite					m_Sprite;
	float							m_Alpha;
	bool							m_IsAlive;

	float							m_Radius;	
	bool							m_bRotate;
	math::Facing					m_Facing;
	float							m_Delay;
	float							m_DamagePower;
	float							m_DamagePercentage;
	BULLET_TYPES					m_Type;
	math::Movement					m_Movement;	
	math::Vec2						m_Variation;	
	math::Vec2						m_StartPos;
	bool							m_IsTypeGauss;
	bool							m_bLeaveAlphaTrail;

	WDSLifeObject*					m_pIgnoreObj;

};

#endif